package com.woniuxy.myshop.service;

import com.woniuxy.myshop.entity.Cart;
import com.woniuxy.myshop.mapper.CartMapper;
import com.woniuxy.myshop.vo.CartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartService {

    @Autowired
    CartMapper cartMapper ;

    public CartVo queryCartByPidAndUserId(int pid, Integer uid) {

        return cartMapper.selectCartByPidAndUserId(pid,uid);
    }

    public void addBuyCount(int pid, Integer userid) {
        cartMapper.inCreCount(pid,userid);
    }

    public void addCart(CartVo cart) {
        cartMapper.insertCart(cart);
    }

    public List<CartVo> queryMyCart(Integer id) {
        return  cartMapper.selectMyCart(id);
    }
}
